﻿@{
    ViewBag.Title = "页面列表";
    Layout = "~/Views/Shared/_Form.cshtml";
    string v = System.Configuration.ConfigurationManager.AppSettings["version"];

}

@section styles{
    <link href="~/Scripts/ztree/zTreeStyle/zTreeStyle.css?v=@v" rel="stylesheet" />
}

@section scripts
{
    <script src="~/Scripts/ztree/jquery.ztree.all.min.js?v=@v"></script>
    <script src="~/Scripts/page/wike.ztree.js?v=@v"></script>
    <script type="text/javascript">
        var id;
        var name;

        function beforeClick(treeId, treeNode) {
           
            id = treeNode.id;
            name = treeNode.name;
        }

        function getContent() {
            
            var rowData = {};
         
            rowData.Id = id;
            rowData.CategoryName = name;
            return rowData;
        }

        var config = {
            id: 'pageTree',
            loadUrl: '@Url.Action("GetTrees")',
            addUrl: '@Url.Action("Add")',
            editUrl: '@Url.Action("Edit")',
            deleteUrl: '@Url.Action("Delete")',
            beforeClick: beforeClick
        };
        var pageTree = new WikeTree(config);
        pageTree.load();
        $("#btnCancel").click(function() {
            var zTree = $.fn.zTree.getZTreeObj(config.id);
            zTree.cancelSelectedNode();
            $("#txtParentId").val("");
        });
    </script>
}


<input id="txtParentId" type="hidden" />
<ul id="pageTree" class="ztree">
    <li>页面加载中......</li>
</ul>